package com.webchat.common.enums;


import com.webchat.common.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum AccountRelationTypeEnum {


    USER_AI_AGENT(0, "我的AI助手（默认添加）"),
    USER_USER(1, "好友关注"),
    USER_GROUP(2, "加入群聊"),
    USER_OFFICIAL(3, "订阅公众号"),
    USER_ROBOT(4, "添加机器人"),
    USER_SERVER(5, "用户订阅服务号"),
    ;

    private Integer type;
    private String typeName;

    public static AccountRelationTypeEnum getByTargetAccountRoleCode(int roleCode) {
        switch (roleCode) {
            case 0:
                return AccountRelationTypeEnum.USER_AI_AGENT;
            case 1:
            case 2:
            case 3:
                return AccountRelationTypeEnum.USER_USER;
            case 4:
                return AccountRelationTypeEnum.USER_GROUP;
            case 5:
                return AccountRelationTypeEnum.USER_ROBOT;
            case 6:
                return AccountRelationTypeEnum.USER_OFFICIAL;
            case 7:
                return AccountRelationTypeEnum.USER_SERVER;

        }
        log.error("不支持的关系类型 =====> roleCode: {}", roleCode);
        throw new BusinessException("不支持的关系类型");
    }
}
